$(function () {
    $("button#sou").click(function (){
        //如果有搜索按钮，定义一个onclick即可
        // 声明变量
        var input, filter, table, tr, td,td1,td2,td3,td4,td5, i;
        input = document.getElementById("key");
        filter = input.value.toUpperCase(); //toUpperCase()是不区分大小写
        console.log(filter);
        table = document.getElementById("myTable");
        tr = table.getElementsByTagName("tr");

        // 循环表格每一行，查找匹配项
        for (i = 0; i < tr.length; i++) {
            td = tr[i].getElementsByTagName("td")[0]; //这个0时要搜索第1列的内容，以此类推
            td1 = tr[i].getElementsByTagName("td")[1];
            td2 = tr[i].getElementsByTagName("td")[2];
            td3 = tr[i].getElementsByTagName("td")[3];
            td4 = tr[i].getElementsByTagName("td")[4];
            td5 = tr[i].getElementsByTagName("td")[5];



            if (td || td1 || td2 || td3 || td4 || td5 ) {
                if (td.innerHTML.toUpperCase().indexOf(filter) > -1
                    || td1.innerHTML.toUpperCase().indexOf(filter) > -1
                    || td2.innerHTML.toUpperCase().indexOf(filter) > -1
                    || td3.innerHTML.toUpperCase().indexOf(filter) > -1
                    || td4.innerHTML.toUpperCase().indexOf(filter) > -1
                    || td5.innerHTML.toUpperCase().indexOf(filter) > -1
                 ) {  //如果要区分大小写就去掉这个toUpperCase()
                    tr[i].style.display = "";
                } else {
                    tr[i].style.display = "none";
                }
            }
        }


    });
});